#pragma version(1)
#pragma rs java_package_name(win.smartown.android.library.certificateCamera.detection)

rs_allocation gIn;
rs_allocation gOut;
rs_script gScript;

static int mImageWidth;
static int mImageHeight;
const uchar4 *gPixels;

void init() {
}

void root(const uchar4 *v_in, uchar4 *v_out, const void *usrData, uint32_t x, uint32_t y) {
	*v_out = gPixels[(mImageHeight-y -1) + (mImageWidth-1-x)*mImageHeight];
	return;
}

void filter() {
    mImageWidth = rsAllocationGetDimX(gOut);
    mImageHeight = rsAllocationGetDimY(gOut);

    //rsDebug("In image size is ", rsAllocationGetDimX(gIn), rsAllocationGetDimY(gIn));
    //rsDebug("Out image size is ", rsAllocationGetDimX(gOut), rsAllocationGetDimY(gOut));

    rsForEach(gScript, gIn, gOut);
}
